import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("menu", { schema: "charge" })
export class Menu {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "name", length: 30 })
  name: string;

  @Column("varchar", { name: "type", length: 10 })
  type: string;

  @Column("varchar", { name: "path", length: 50 })
  path: string;

  @Column("varchar", { name: "component", length: 50 })
  component: string;

  @Column("varchar", { name: "permission", length: 100 })
  permission: string;

  @Column("varchar", { name: "api", length: 100 })
  api: string;

  @Column("varchar", { name: "api_method", length: 10 })
  apiMethod: string;

  @Column("boolean", { name: "keep_alive"})
  keepAlive: boolean;

  @Column("boolean", { name: "display"})
  display: boolean;

  @Column("boolean", { name: "enable"})
  enable: boolean;

  @Column("smallint", { name: "sort", default: () => "'1'" })
  sort: number;

  @Column("smallint", { name: "parent_id", default: () => "'0'" })
  parentId: number;
}
